package com.xr.baseData;

import java.util.Date;

import com.xr.common.CommUtil;
import com.xr.common.Tools;
import com.bstek.dorado.common.*;
import com.bstek.dorado.common.rtexpr.impl.ExpressionUtils;
import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.DBStatement;
import com.bstek.dorado.view.*;
import com.bstek.dorado.view.data.*;
import com.bstek.dorado.view.control.*;

/**
 * BaseDataEditViewModel
 */
public class BaseDataEditViewModel extends DefaultViewModel {
  protected void doUpdateData(ParameterSet parameters, ParameterSet outParameters)
      throws Exception {
		DBStatement dbs = new DBStatement();
		Dataset ds = getDataset("datasetBaseData");
		RecordIterator ri = ds.recordIterator();
		ri.setVisibility(Dataset.FILTER_MODIFIED);
		while (ri.hasNext()) {
		  Record record = ri.nextRecord(); 
		  record.setValue("MODIFY_ID", CommUtil.getEmployeeId());
		  record.setValue("MODIFY_DATE", Tools.format(new java.util.Date(),"yyyy-MM-dd HH:mm:ss"));
		}
		CommUtil.dbsUpdateData(dbs, ds, "PB_BASEDATA", "BASEDATA_ID","general");
		
		  ri = ds.recordIterator();
		ri.setVisibility(Dataset.FILTER_DELETED);
		while (ri.hasNext()) {
		  Record record = ri.nextRecord(); 
		  CommUtil.executeUpdate(dbs,"update PB_BASEDATA set dr=1,dr_id="+CommUtil.getEmployeeId()+",dr_date=sysdate where BASEDATA_ID="+record.getString("BASEDATA_ID"));
		  
		}
		dbs.close();
		 
	  
    //super.doUpdateData(parameters, outParameters);
  }

}
